# coding=utf-8
"""
    @project: 15python_spider
    @Author：frank
    @file： 10_re_html_fetch.py
    @date：2023/12/25 21:25
"""
import re

html = '''
<div class="animal">
    <p class="name">
        <a title="Tiger"></a>
    </p>
    <p class="content">
        Two tigers two tigers run fast
    </p>
</div>
​
<div class="animal">
    <p class="name">
        <a title="Rabbit"></a>
    </p>
​
    <p class="content">
        Small white rabbit white and white
    </p>
</div>

'''

content = re.compile(r'title=\"(\w+?)\">.+?class=\"content\">(.+?)</p>+', re.S)
r_list = content.findall(html)
for rt in r_list:
    print('动物名称:', rt[0].strip())
    print('动物描述:', rt[1].strip())
    print('*' * 50)
